package com.example.ds.config;

import com.example.ds.plugins.SlowSqlInterceptor;
import org.mybatis.spring.boot.autoconfigure.ConfigurationCustomizer;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MybatisConfig   {

    @Value("${slow.sql.threshold: 1}")
    private Long slowSqlThreshold;

    @Bean
    public SlowSqlInterceptor slowSqlInterceptor() {
        return new SlowSqlInterceptor(slowSqlThreshold);
    }

}
